﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FB.Videos.ucCommon;
using FB.Bussiness;
using FB.DataAccess;

namespace FB.Videos
{
    public partial class watch : System.Web.UI.Page
    {
        /// <summary>
        ///  View State VideoTitle
        /// </summary>
        public string VideoTitle
        {
            get
            {
                object obj = this.ViewState["_VideoTitle"];
                if (obj == null)
                    return ""; //default to show ID : 0 
                else
                    return (string)obj;
            }
            set
            {
                this.ViewState["_VideoTitle"] = value;
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            string VideoID = Request.QueryString["v"];

            VideoBO VBO = new VideoBO();
            Video VideoPlay = VBO.GetVideoByYouTubeID(VideoID);
            if (VideoPlay != null)
            {
                VideoTitle = VideoPlay.Title;
            }
            ucPlayVideo ucVideoPlayer = (ucPlayVideo)LoadControl("ucCommon/ucPlayVideo.ascx");
            ucVideoPlayer.ID = "ucUserCtrl1";
            ucVideoPlayer.ObjectID = VideoID;
            plPlayVideo.Controls.Add(ucVideoPlayer);
        }
    }
}